home *** CD-ROM | disk | FTP | other *** search
- Path: prairienet.org!sjmccaug
- From: sjmccaug@prairienet.org (Scott J. McCaughrin)
- Newsgroups: comp.lang.c++
- Subject: Re: Object with Interrupt Service Routine
- Date: 20 Jan 1996 03:52:26 GMT
- Organization: University of Illinois at Urbana
- Message-ID: <4dpotq$5lc@vixen.cso.uiuc.edu>
- References: <DL8B3G.MuB@mv.mv.com> <4d6imm$okq@newsbf02.news.aol.com>
- Reply-To: sjmccaug@prairienet.org (Scott J. McCaughrin)
- NNTP-Posting-Host: firefly.prairienet.org
-
-
- In a previous article, ENGR@GSSI.MV.COM (Michael Furman) says:
-
- >In article <4d6imm$okq@newsbf02.news.aol.com>, awhang8367@aol.com says...
- >>
- >> I have been struggling to create an object that handles hardware
- >>interrupt directly. Particularly with the setvect function as it takes in
- >>pointers to interrupts
- >>^^^^^^^^^
- >>and not to objects. Two things I can do (and I have accomplished ther
- >>former):
- >>
- >> 1) Use an interrupt service routine to call the object.
- >
- >If you mean "call nonstatic member function of the object" - why not. I see
- >only two problems:
-
- Since Mr. Furman admits to having accompished this goal, why belabor it?
-
- > 1. - how to obtain pointer to the instance that corresponds to this
- > interrupt.
-
- Wrong -- what you wnat is a THIS ptr to the object containing the int function.
-
- > 2. - size of current stack. If it is asynchronous interrupt - it may
- >happend at any time and nobody can garantee you that you have a stack space
- >big enough for executing your function.
- >
-
- Then you should either use the calling program's stack or dynamically
- allocate. Otherwise, each re-entrance re-inits your SP to the stack-top.
-
- >> 2) directly write the address of the member function to the Interrupt
- >>vector table
- >You can, but only for static member function (and it probably should be
- >declared with "interrupt" keyword - but it, like other staff, highly CPU/OS
- >dependable). To call nonstatic member function you must supply pointer to the
- >instance of your class (my problem "1").
-
- Not so -- just install your member function as a re-entrant TSR and
- chain to the next handler.
-
- >>
- >> Both implementations seems to be very clumsy. Does anyone know of a
- >>good way of doing it? Any pointer or email interrupt will be greatly
- >>appreciated.
- >
- Scott McC.
-
-